package org.googlecode.viewt.core.tools.po;

import java.util.HashMap;
import java.util.Map;

public class DescGenerator extends BasePOGenerator {
	public static final String CONTEXT_PROP_NESTPOMAP = "NESTPOMAP";

	public String getLoggerCategory() {
		return "DescGenerator";
	}

	public String getTemplate(String className) throws Exception {
		return "java_DESC.vm";
	}

	public String getOutputFile(String className) throws Exception {
		return POConfigUtil.fullJavaFileName(getDestPath(), POConfigUtil
				.descriptorClassName(className));
	}

	public boolean needGenerate(String className) throws Exception {
		return true;
	}

	public void setupContext() throws Exception {
		Map nestPOMap = (Map) getContext().get("NESTPOMAP");
		if (nestPOMap == null)
			getContext().put("NESTPOMAP", new HashMap());
	}

	public void setupContext(String className) throws Exception {
		Map nestPOMap = (Map) getContext().get("NESTPOMAP");
		nestPOMap.clear();
	}

	public void cleanContext(String className) throws Exception {
	}

	public void cleanContext() throws Exception {
		getContext().remove("NESTPOMAP");
	}
}